package tsinghua.smxq.ui;

import tsinghua.smxq.mc.BusLineSearchActivity;
import tsinghua.smxq.mc.FoodPriceRequestActivity;
import tsinghua.smxq.mc.MapSearchActivity;
import tsinghua.smxq.mc.MobileCityActivity;
import tsinghua.smxq.mc.R;
import tsinghua.smxq.mc.ReqActivity;
import tsinghua.smxq.mc.StockSearchActivity;
import tsinghua.smxq.mc.WeatherSearchActivity;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;

public class MCListViewListener implements OnItemClickListener {
	Activity context;

	public MCListViewListener(Activity context) {
		this.context = context;
	}

	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		// TODO Auto-generated method stub
		if (arg2 == MCMenuAdapter.currPosition) {
			return;
		}
		switch (arg2) {
		case 0:
			MCMenuAdapter.currPosition = 0;
			context.startActivity(new Intent(context, MobileCityActivity.class));
			context.overridePendingTransition(R.anim.push_in, R.anim.push_out);
			context.finish();

			break;
		case 1:
			MCMenuAdapter.currPosition = 0;
			context.startActivity(new Intent(context,
					BusLineSearchActivity.class));
			context.overridePendingTransition(R.anim.push_in, R.anim.push_out);
			context.finish();

			break;
		case 2:
			MCMenuAdapter.currPosition = 0;
			context.startActivity(new Intent(context, FoodPriceRequestActivity.class));
			context.overridePendingTransition(R.anim.push_in, R.anim.push_out);
			context.finish();

			break;
		case 3:
			MCMenuAdapter.currPosition = 0;
			context.startActivity(new Intent(context,
					WeatherSearchActivity.class));
			context.overridePendingTransition(R.anim.push_in, R.anim.push_out);
			context.finish();

			break;
		case 4:
			MCMenuAdapter.currPosition = 0;
			context.startActivity(new Intent(context, MapSearchActivity.class));
			context.overridePendingTransition(R.anim.push_in, R.anim.push_out);
			context.finish();

			break;
		case 5:
			MCMenuAdapter.currPosition = 0;
			context.startActivity(new Intent(context, StockSearchActivity.class));
			context.overridePendingTransition(R.anim.push_in, R.anim.push_out);
			context.finish();

			break;
		case 6:
			MCMenuAdapter.currPosition = 0;
			context.startActivity(new Intent(context, ReqActivity.class));
			context.overridePendingTransition(R.anim.push_in, R.anim.push_out);
			context.finish();

			break;
		}
	}

}
